//
//  LRXDistributionViewCell.m
//  路人侠
//
//  Created by zhangxulong on 4/4/16.
//  Copyright © 2016 zhangxulong. All rights reserved.
//

#import "LRXDistributionViewCell.h"
@interface LRXDistributionViewCell()
@property (nonatomic,strong) UILabel * thingName;
@property (nonatomic,strong) UILabel * thingMoney;
@end
@implementation LRXDistributionViewCell
- (UILabel *)thingName
{
    if (_thingName == nil) {
        _thingName = [[UILabel alloc]init];
    }
    return _thingName;
}
- (UILabel *)thingMoney
{
    if (_thingMoney == nil) {
        _thingMoney = [[UILabel alloc]init];
    }
    return _thingMoney;
}
- (void)layoutDistributionCell:(LRXThing *)thing
{
    NSString * thingCount;
    if ([thing.thingCount integerValue] > 1)
        thingCount = [NSString stringWithFormat:@"x%@",thing.thingCount];
    else
        thingCount = @"";
    
    self.thingName.text = [NSString stringWithFormat:@"%@%@",thing.thingName, thingCount];
    self.thingMoney.text = [NSString stringWithFormat:@"%@元",thing.thingMoney];
    
    self.thingName.frame = CGRectMake(42 * wScale, 30 * hScale, 0, 0);
    self.thingName.font = [UIFont systemFontOfSize: 28 * hScale];
    [self.thingName sizeToFit];
    
    
    self.thingMoney.frame = CGRectMake(444 * wScale, 30 *hScale, 150 * wScale , 28 * hScale);
    self.thingMoney.textAlignment = NSTextAlignmentRight;
    self.thingMoney.font = self.thingName.font;
  
    
    [self addSubview:self.thingName];
    [self addSubview:self.thingMoney];
}

@end
